<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$intID = (int)$_data["ID"];
$arrGame = getGambleDataByID($intID);

if(!is_array($arrGame) || sizeof($arrGame) == 0 || $arrGame["isEnd"] == 1){
	@mysql_close($$_Conn);
	header("Location: ".basename($_SERVER["PHP_SELF"])."?op=List");
	exit();
}

$arrLotto = GetLottoData($arrGame["LottoID"]);
if(!$arrLotto)ErrMsgOutputHTML("Error", "", 1);

$fp = @file($strTemplatePath."Edit.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
if(!$_arrPermitTimeItems[$arrLotto["ID"]]){
	$fp = preg_replace("/<!-- @ OGameNo Sd @ \/\/-->.+<!-- @ OGameNo End @ \/\/-->/s", "", $fp);
}

$fp = str_replace("{LType}", $arrLotto["LType"], $fp);
$fp = str_replace("{ShowID}", $intID, $fp);
$fp = str_replace("{ShowLottoID}", $arrGame["LottoID"], $fp);
$fp = str_replace("{ShowLotto}", $arrLotto["Lotto_".$_intLang], $fp);
$fp = str_replace("{ShowSerialNo}", $arrGame["SerialNo"], $fp);
$fp = str_replace("{ShowOSerialNo}", $arrGame["OSerialNo"], $fp);

$strGameDate = DateForm($arrGame["GameDate"], $arrGame["GameTime"], "Y-m-d");
$strGameTime = TimeForm($arrGame["GameDate"], $arrGame["GameTime"], "H:i:s");

$strEndGameTime = TimeForm($arrGame["GameDate"], $arrGame["EndGameTime"], "H:i:s");
$strEndGameTimeSN = TimeForm($arrGame["GameDate"], $arrGame["EndGameTimeSN"], "H:i:s");
//print_r($arrGame);

$fp = str_replace("{ShowGameDate}", $strGameDate, $fp);
$fp = str_replace("{ShowGameTime}", $strGameTime, $fp);
$fp = str_replace("{ShowEndGameTime}", $strEndGameTime, $fp);
$fp = str_replace("{ShowEndGameTimeSN}", $strEndGameTimeSN, $fp);

while(list($k, $v) = each($_strCompetition)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

if($arrLotto["LType"] == 1){
	$fp = preg_replace("/<!-- @ HiddenEndGTime Sd @ \/\/-->.+<!-- @ HiddenEndGTime End @ \/\/-->/s", "", $fp);
}else{
	$fp = preg_replace("/<!-- @ ShowEndGTime Sd @ \/\/-->.+<!-- @ ShowEndGTime End @ \/\/-->/s", "", $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>